home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Leonardo the Inventor
/
Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso
/
LEOWINMV
/
DATABASE.DIR
/
00084_Script_DB CLICK BROWSER
< prev
next >
Wrap
Text File
|
1996-03-28
|
5KB
|
180 lines
-- ---------------------------------------------------------------
-- Handler doClickBrowser: (1) hilites the topic name the user
-- clicked on, (2) shows its description.
on doClickBrowser
chooseTopicInBrowser(the mouseLine)
end
-- ---------------------------------------------------------------
-- Handler clickedBrowserHilite
on clickedBrowserHilite
global clickedLine
chooseTopicInBrowser clickedLine
end
-- ---------------------------------------------------------------
-- Handler chooseTopicInBrowser
on chooseTopicInBrowser whichLine
-- the following if statement is used in case the user clicks
-- something on the browser and then moves the mouse over another
-- field. (if the above case did occur, clickedLine would be -1 and
-- the hilit topic would appear above the find button)
set lClickedTopic = line whichLine of field "browser"
if (whichLine > 0) and (lClickedTopic <> "") then
-- clear the screen from the previous topic
clearDatabase
-- hilite the clicked topic in the browser
selectTopic(whichLine)
-- show the clicked topic
showSelectedTopic
end if
end
-- --------------------------------------------------------
-- Handler selectTopic selects the topic in the given line
-- of the browser.
on selectTopic whichLine
global clickedTopic, clickedLine
set clickedLine = whichLine
set clickedTopic = line clickedLine of field "browser"
hiliteClickedTopic
updateStage -- to show hiliting as soon as possible
end
-- --------------------------------------------------------
-- Handler showSelectedTopic (1) shows the text of the clicked
-- topic, (2) shows the title of the clicked topic and (3)
-- sets the buttons of the clicked topic.
-- It is called from findUserTypedTopic and doClickBrowser
on showSelectedTopic
global textButton, mode
setBrowserTopicsLine
showTitle
setTopicButtons
setNumPagesInClickedTopic
setNumPicturesInClickedTopic
if (mode = "index") or (mode = "search") then
showText
else if (mode = "media") then
showPicture
end if
updateStage
end
-- ---------------------------------------------------------------
-- Handler hiliteClickedTopic hilites the clicked line in the browser.
on hiliteClickedTopic
global clickedLine, hilitTopic, clickedTopic, browser
global browserLineHeight
put " " into cast "hilitTopic"
set the locV of sprite hilitTopic = (the top of sprite browser) + (clickedLine-1) * (browserLineHeight)
put clickedTopic into cast "hilitTopic"
end
-- ---------------------------------------------------------------
-- Handler unhiliteClickedTopic clears the last hilit line.
on unhiliteClickedTopic
global hilitTopic
removeFromStage(hilitTopic)
end
-- ---------------------------------------------------------------
-- Handler showTitle displays the title of the clickedTopic in the
-- field "Topic Title".
on showTitle
global clickedTopic
-- first, remove old styles
put " " into cast "Topic Title"
set the textStyle of cast "Topic Title" = "plain"
-- now, add the new style
if isPictureTitle(clickedTopic) then
set the textStyle of cast "Topic Title" = "bold,italic"
else
set the textStyle of cast "Topic Title" = "bold"
end if
put clickedTopic into cast "Topic Title"
-- set the forecolor of cast "Topic Title" to 255
end
-- ---------------------------------------------------------------
-- Handler showTopicText shows the text of the clicked topic.
-- It uses binary search on pre-compiled lookup tabel which is faster
-- than having Director get castnum of named cast.
-- Also, calling setTopicTextAttributes with a castNum instead of
-- castName saves several lookups by Director.
on showTopicText
global textSprite, clickedTopic, currentPage
-- switch cast members instead of copying text over to preserve
-- the text styles and colors of each field.
set textcastNum = getTextCastNumber(clickedTopic, currentPage)
if (textcastNum = -1) then
set clickedTopic = getEquivalentTerm(clickedTopic)
exit
end if
setTopicTextAttributes(textcastNum)
set the castNum of sprite textSprite = textcastNum
showMoreButtons
setClearedFlag(False)
updatestage
end
-- ---------------------------------------------------------------
-- Handler setBrowserTopicsLine sets the global variable
-- browserTopicsLine to the corresponding line of the field
-- "browserTopics" that was clicked.
on setBrowserTopicsLine
global clickedTopic, browserTopicsLine, browserTopics, masterBrowserTopics
if (clickedTopic = "") then
set browserTopicsLine = 0
else
set foundLine = binSearchFirstItemInLine(masterBrowserTopics, clickedTopic, ":")
if foundLine then
set browserTopicsLine = foundLine
set oldDelimiter = the itemDelimiter
set the itemDelimiter = ":"
set clickedTopic = item 1 of line foundLine of masterBrowserTopics -- to get correct capitalization
set the itemDelimiter = oldDelimiter
else
nothing
-- alert("foundLine = 0 in setBrowserTopicsLine")
end if
end if
end
on removeFromStage whichSprite
set the locV of sprite whichSprite = 1000
updateStage
end